package com.jj.pojo.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import jdk.nashorn.internal.ir.annotations.Ignore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Description:
 * Author: JJ
 * Date:2025-08-30
 * Time:13:24
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class R<T> {

    private Integer code;
    private String msg;
    private T data;


    public static <T>R<T> ok(T data) {
        return new R<>(200,"success",data);
    }


    public static <T>R<T> fail() {

        return R.<T>builder()
                .code(500)
                .msg("error")
                .build();
    }

}
